export const querystring = {
  parse(url: string) {
    const query = url.split('?')[1];
    const params = query.split('&');
    const result: Record<string, string> = {};
    params.forEach(param => {
      const [key, value] = param.split('=');
      result[key] = value;
    });
    return result;
  },
  stringify(params: Record<string, string | number | boolean>) {
    let result = '';
    Object.entries(params).forEach(([key, value]) => {
      result += `${key}=${value}&`;
    });
    return result.slice(0, -1);
  },
};
